package com.study.meng.bigevent.mapper;

import com.study.meng.bigevent.entity.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author Administrator
 * @description 针对表【category】的数据库操作Mapper
 * @createDate 2025-06-23 14:34:49
 * @Entity com.study.meng.bigevent.entity.Category
 */
@Mapper
public interface CategoryMapper {
    @Insert("INSERT INTO category (category_name, category_alias,create_user,create_time,update_time) VALUES (#{categoryName}, #{categoryAlias},#{createUser},now(),now())")
    int insert(Category category);

    @Select("SELECT * FROM category where create_user = #{createUser}")
    List<Category> selectAll(Integer createUser);

    @Select("SELECT * FROM category WHERE id = #{id}")
    Category selectById(Integer id);

    @Update("UPDATE category SET category_name = #{categoryName}, category_alias = #{categoryAlias}, update_time = now() WHERE id = #{id}")
    int update(Category category);

    @Delete("DELETE FROM category WHERE id = #{id}")
    int delete(Integer id);
}




